package com.binhthuan.catechist.client.data;

import com.binhthuan.catechist.client.ECApplication;
import com.binhthuan.catechist.shared.constant.Parameter;
import com.binhthuan.catechist.shared.constant.Service;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class StatusDS extends AbstractDS {

    public StatusDS() {
	this(Service.STATUS);
    }

    public StatusDS(String id) {
        super(id);

        DataSourceIntegerField idField = new DataSourceIntegerField(Parameter.ID);
        idField.setHidden(true);
        idField.setPrimaryKey(true);

        DataSourceTextField nameField = new DataSourceTextField(Parameter.NAME);

        setFields(idField, nameField);
        setFetchDataURL(ECApplication.encodeURL(null, null, null, Parameter.STATUS_TYPE + "=" + getStatusType()));
        setAddDataURL(ECApplication.encodeURL(null, null, null, Parameter.STATUS_TYPE + "=" + getStatusType()));
        setUpdateDataURL(ECApplication.encodeURL(null, null, null, Parameter.STATUS_TYPE + "=" + getStatusType()));
        setRemoveDataURL(ECApplication.encodeURL(null, null, null, Parameter.STATUS_TYPE + "=" + getStatusType()));
    }

    public int getStatusType() {
        return 0;
    }
}
